<template>
	<div class="app-container">
		<el-row>
			<el-col :sm="24" :lg="24">
				<el-text>当前版本</el-text>
				<el-input v-model="version" readonly="true" />
				<el-button type="success" plain @click="update()">更新</el-button>
			</el-col>

			<col :sm="24" :lg="24">
				<el-progress :percentage="percentage" :stroke-width="15" striped striped-flow
					:duration="duration" />
			</col>

			<el-button-group>
				<el-button @click="increase">加</el-button>
				<el-button @click="decrease">减</el-button>
			</el-button-group>
		</el-row>
	</div>
</template>

<script>
	import {
		listUser,
		getUser,
		delUser,
		addUser,
		updateUser,
		resetUserPwd,
		changeUserStatus,
		deptTreeSelect
	} from "@/api/system/user";
	import {
		getToken
	} from "@/utils/auth";
	import Treeselect from "@riophae/vue-treeselect";
	import "@riophae/vue-treeselect/dist/vue-treeselect.css";

	import {
		computed,
		ref
	} from 'vue'

	export default {
		name: "User",
		dicts: ['sys_normal_disable', 'sys_user_sex'],
		components: {
			Treeselect
		},
		data() {
			return {
				version: "1.0.0",
				percentage: 50,
				duration: 10,
			}
		},
		watch: {},
		created() {},
		methods: {
			getNewVersion() {
				return "1.0.0";
			},
			update() {
				console.log("update函数")
				if (this.version == this.getNewVersion()) {
					console.log("相等");
					this.$modal.confirm('已经是最新版本').then(function() {
						return;
					}).then(() => {
						// this.getList();
						// this.$modal.msgSuccess("删除成功");
					}).catch(() => {});
				} else {
					console.log("不等");
					this.$modal.confirm('当前版本为1.0.0,新版本为1.0.1,确定更新吗?').then(function() {
						return;
					}).then(() => {
						this.$modal.msgSuccess("更新成功");
					}).catch(() => {});
				}
			},
			increase() {
				this.percentage += 10
				if (this.percentage > 100) {
					this.percentage = 100
				}
			},
			decrease() {
				this.percentage -= 10
				if (this.percentage < 0) {
					this.percentage = 0
				}
			},
		}
	}
</script>

<style scoped>
	.demo-progress .el-progress--line {
		margin-bottom: 15px;
		max-width: 600px;
	}
</style>